package bomberman.runable;

import java.util.List;

import bomberman.model.Bom;
import bomberman.model.Flame;
import bomberman.swing.BomJPanel;

/**
 * 火焰碰撞炸弹线程，控制炸弹连锁爆炸
 * @author EX-FUHUICHAO001
 * 2016年9月27日18:48:27
 */
public class MyRunableFlameTouchBom implements Runnable {

	private List<Flame> flames;
	
	public MyRunableFlameTouchBom(List<Flame> flames){
		this.flames = flames;
	}
	
	public void run() {
		// 若火焰未移除，则持续检测
		while(!flames.get(0).isRemove()){
			for(Flame flame : flames){
				for(Bom bom : BomJPanel.boms){
					if(!flame.isRemove() && !bom.isBoom() && flame.getRect().intersects(bom.getRect())){
						bom.boom();
					}
				}
			}
		}
	}

	
	public List<Flame> getFlames() {
		return flames;
	}

	public void setFlames(List<Flame> flames) {
		this.flames = flames;
	}

	
}
